package com.cp.oss.util;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author ming
 * @create 2022/7/29
 * @description:
 */
@Data
@Component
@ConfigurationProperties(prefix = "aliyun.oss")
public class OssProperties implements InitializingBean {
    private String endPoint;
    private String keyId;
    private String keySecret;
    private String bucketName;
    public static  String ENDPOINT;
    public static  String KEY_ID;
    public static  String KEY_SECRET;
    public static  String BUCKET_NAME;

    @Override
    //Spring 自动赋值后调用的方法
    public void afterPropertiesSet() throws Exception {
        ENDPOINT = endPoint;
        KEY_ID = keyId;
        KEY_SECRET = keySecret;
        BUCKET_NAME = bucketName;


    }
}
